package Multithreading.Exercise001;

/**
 * ClassName:MyThread
 * Package:Multithreading.Exercise
 * Description:
 *
 * @Author:ZhangXin
 * @Create2023/3/5-15:11
 * @Version:v1.0
 */
public class MyThread extends Thread{
    public MyThread() {
    }

    public MyThread(String name) {
        super(name);
    }

    @Override
    public void run() {

        for (int i = 0; i < 100; i++) {
//            try {
//                Thread.sleep(1000);
//            } catch (InterruptedException e) {
//                e.printStackTrace();
//            }
            System.out.println(getName()+"@"+i);

            //出让当前CPU的执行权
            Thread.yield();
        }
    }
}
